<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('薪資明細')" />
    <th:block th:include="include :: bootstrap-select-js" />
    <th:block th:include="include :: layout-latest-css" />
    <th:block th:include="include :: ztree-css" />

</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <p>一级部门：</p>
                            <!--<select  name="dept" id="dept" class="form-control">-->
                                <!--<option></option>-->
                                <!--<option th:each="pro:${deptinfos}" th:value="${pro.id}"-->
                                        <!--th:text="${pro.dept}"></option>-->
                            <!--</select>-->
                            <input type="text" name="dept"/>
                        </li>
                        <li>
                            <p>月份：</p>
                            <select  name="month" id="month" class="form-control">
                                <option></option>
                                <option th:each="pro:${monthinfos}" th:value="${pro.id}"
                                        th:text="${pro.month}"></option>
                            </select>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" >
                <i class="fa fa-plus"></i> 添加
            </a>

            <a class="btn btn-warning" onclick="$.table.exportExcel()" >
                <i class="fa fa-download"></i> 导出
            </a>
            <a class="btn btn-info" onclick="$.table.importExcel()">
                <i class="fa fa-upload"></i> 导入
            </a>

        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: layout-latest-js" />
<th:block th:include="include :: datetimepicker-js"/>
<th:block th:include="include :: ztree-js" />
<script th:inline="javascript">
    var prefix = ctx + "cost";

    $(function() {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            importUrl: prefix + "/importData",
            modalName: "",
            columns: [{
                checkbox: true
            },
                {
                    field : 'id',
                    title : '序号',
                    visible: false
                },
                {
                    field : 'dept',
                    title : '一级部门',
                    sortable: true
                },
                {
                    field : 'month',
                    title : '月份',
                    sortable: true
                },
                {
                    field : 'number',
                    title : '人数'
                },
                {
                    field : 'wages',
                    title : '工资'
                },
                {
                    field : 'oilPatch',
                    title : '油补'
                },
                {
                    field : 'socialSecurity',
                    title : '社保'
                },
                {
                    field : 'accumulationFund',
                    title : '公积金'
                },
                {
                    field : 'totalCost',
                    title : '费用合计'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs '  + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs '  + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    $("input[name='dateEntry']").datetimepicker({
        format: "yyyy-mm-dd",
        minView: "month",
        autoclose: true
    });
</script>

<!-- 导入区域 -->
<script id="importTpl" type="text/template">
    <form enctype="multipart/form-data" class="mt20 mb10">
        <div class="col-xs-offset-1">
            <input type="file" id="file" name="file"/>
            <div class="mt10 pt5">
                <input type="checkbox" id="updateSupport" name="updateSupport" title="如果登录账户已经存在，更新这条数据。"> 是否更新已经存在的用户数据
                &nbsp;	<a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
            </div>
            <font color="red" class="pull-left mt10">
                提示：仅允许导入“xls”或“xlsx”格式文件！
            </font>
        </div>
    </form>
</script>

</body>
</html>